package com.ktgj.service.controller;

import java.util.List;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.ktgj.common.log.annotation.Log;
import com.ktgj.common.log.enums.BusinessType;
import com.ktgj.common.security.annotation.PreAuthorize;
import com.ktgj.service.domain.OrderitemViphall;
import com.ktgj.service.service.IOrderitemViphallService;
import com.ktgj.common.core.web.controller.BaseController;
import com.ktgj.common.core.web.domain.AjaxResult;
import com.ktgj.common.core.utils.poi.ExcelUtil;
import com.ktgj.common.core.web.page.TableDataInfo;

/**
 * 贵宾厅订单明细Controller
 * 
 * @author ruoyi
 * @date 2021-09-03
 */
@ControllerAdvice
@RestController
@RequestMapping("/orderviphall")
public class OrderitemViphallController extends BaseController
{
    @Autowired
    private IOrderitemViphallService orderitemViphallService;

    /**
     * 查询贵宾厅订单明细列表
     */
    //@PreAuthorize(hasPermi = "service:viphall:list")
    @GetMapping("/list")
    public TableDataInfo list(OrderitemViphall orderitemViphall)
    {
        startPage();
        List<OrderitemViphall> list = orderitemViphallService.selectOrderitemViphallList(orderitemViphall);
        return getDataTable(list);
    }

    /**
     * 导出贵宾厅订单明细列表
     */
    //@PreAuthorize(hasPermi = "service:viphall:export")
    @Log(title = "贵宾厅订单明细 ", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, OrderitemViphall orderitemViphall) throws IOException
    {
        List<OrderitemViphall> list = orderitemViphallService.selectOrderitemViphallList(orderitemViphall);
        ExcelUtil<OrderitemViphall> util = new ExcelUtil<OrderitemViphall>(OrderitemViphall.class);
        util.exportExcel(response, list, "贵宾厅订单明细 数据");
    }

    /**
     * 获取贵宾厅订单明细详细信息
     */
    //@PreAuthorize(hasPermi = "service:viphall:query")
    @GetMapping(value = "/{orderitemviphallId}")
    public AjaxResult getInfo(@PathVariable("orderitemviphallId") Long orderitemviphallId)
    {
        return AjaxResult.success(orderitemViphallService.selectOrderitemViphallById(orderitemviphallId));
    }

    /**
     * 新增贵宾厅订单明细
     */
    //@PreAuthorize(hasPermi = "service:viphall:add")
    @Log(title = "贵宾厅订单明细 ", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody OrderitemViphall orderitemViphall)
    {
        return toAjax(orderitemViphallService.insertOrderitemViphall(orderitemViphall));
    }

    /**
     * 修改贵宾厅订单明细
     */
    //@PreAuthorize(hasPermi = "service:viphall:edit")
    @Log(title = "贵宾厅订单明细 ", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody OrderitemViphall orderitemViphall)
    {
        return toAjax(orderitemViphallService.updateOrderitemViphall(orderitemViphall));
    }

    /**
     * 删除贵宾厅订单明细
     */
    //@PreAuthorize(hasPermi = "service:viphall:remove")
    @Log(title = "贵宾厅订单明细 ", businessType = BusinessType.DELETE)
	@DeleteMapping("/{orderitemviphallIds}")
    public AjaxResult remove(@PathVariable Long[] orderitemviphallIds)
    {
        return toAjax(orderitemViphallService.deleteOrderitemViphallByIds(orderitemviphallIds));
    }
}
